<!DOCTYPE html>

<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="">
    </head>
    <body>
      
        <script>
            var a=1000;
            function f(){
                console.log(a);
                if(false){
                    var a='ni hao'
                }
            }
        f();
        //内层变量覆盖外层变量
        </script>
    </body>
</html>